﻿@model dynamic
<div class="navbar navbar-fixed-top">
    <div class="navbar-inner">
        <div class="container">
            @Html.ActionLink("RentIT", "Index", "Home", new { }, new { @class = "brand" })
            <div class="nav-collapse collapse">
                <ul class="nav">
                    <li class="dropdown"><a href="#" class="dropdown-toggle" data-toggle="dropdown">Movies
                        <b class="caret"></b></a>
                        <ul class="dropdown-menu">
                            <li>
                                @Html.ActionLink("Overview", "Overview", "Movie")
                            </li>
                            <li>
                                @Html.ActionLink("Top rated", "TopRated", "Movie")
                            </li>
                            @if (ViewBag.User.Id > 0 && ViewBag.User.Permissions.Contains("CreateMedia"))
                            {
                                <li>
                                    @Html.ActionLink("Create movie", "Create", "Movie")
                                </li>
                            }
                        </ul>
                    </li>
                    @if (ViewBag.User.Permissions.Contains("OverviewUser"))
                    {
                        <li class="dropdown"><a href="#" class="dropdown-toggle" data-toggle="dropdown">Users
                            <b class="caret"></b></a>
                            <ul class="dropdown-menu">
                                <li>
                                    @Html.ActionLink("Overview", "Overview", "User")
                                </li>
                            </ul>
                        </li>
                    }
                    @if (ViewBag.User.Id > 0)
                    {
                        <li class="dropdown"><a href="#" class="dropdown-toggle" data-toggle="dropdown">Shopping
                            Cart <b class="caret"></b></a>
                            <ul class="dropdown-menu">
                                <li>
                                    @Html.ActionLink("Current cart", "Index", "Cart")
                                </li>
                                <li>
                                    @Html.ActionLink("Purchases", "Purchases", "Cart")
                                </li>
                            </ul>
                        </li>
                    }
                </ul>
                <ul class="nav pull-right">
                    @if (ViewBag.User != null && ViewBag.User.Id > 0)
                    {
                        <li class="dropdown"><a href="#" class="dropdown-toggle" data-toggle="dropdown"><i
                            class="icon-user icon-white"></i>&nbsp;@ViewBag.User.Name<b class="caret"></b> </a>
                            <ul class="dropdown-menu">
                                <li>
                                    @Html.ActionLink("Account", "Index", "User", new { @id = ViewBag.User.Id }, new { })
                                </li>
                                <li>
                                    @Html.ActionLink("Edit account", "Edit", "User", new { @id = ViewBag.User.Id }, new { })
                                </li>
                                <li>
                                    @Html.ActionLink("Log out", "Logout", "User")
                                </li>
                            </ul>
                        </li>
                    }
                    else
                    {
                        <li class="dropdown"><a href="#" class="dropdown-toggle" data-toggle="dropdown">Login
                            <b class="caret"></b></a>
                            <ul class="dropdown-menu" id="login">
                                <li>
                                    <div>
                                        <p>
                                            <b>Login</b> to rent and purchase movies</p>
                                    </div>
                                    <form class="form-inline" method="post" action="/User/Login" target="_top" accept-charset="utf-8">
                                    <label for="Email">
                                        Email:</label><input type="text" class="span3" name="Email" id="Email" placeholder="Email address"
                                            title="Enter your email address">
                                    <label for="Password">
                                        Password:</label><input type="password" class="span2" name="Password" id="Password"
                                            placeholder="Password" title="Enter your password">
                                    <input type="submit" class="btn btn-primary" value="Login">
                                    </form>
                                    <div>
                                        <p>
                                            <i class="icon-plus-sign"></i>&nbsp;@Html.ActionLink("Create account", "Create", "User")</p>
                                    </div>
                                </li>
                            </ul>
                        </li>
                    }
                </ul>
            </div>
        </div>
    </div>
</div>